Micron Document
🎖️GitЯра🎖️


Displaying Raw • Download

core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/MeshLogRepository.kt e85300531e124df08788c1b765d50af1bf6d516d (e8530053) Text, 3.32 KB

T8b949e/*
* Copyright (c) 2025-2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository

Tff7b72import T7ee787kotlinx.coroutines.flow.Flow
Tff7b72import T7ee787org.meshtastic.core.model.MeshLog
Tff7b72import T7ee787org.meshtastic.proto.MeshPacket
Tff7b72import T7ee787org.meshtastic.proto.MyNodeInfo
Tff7b72import T7ee787org.meshtastic.proto.PortNum
Tff7b72import T7ee787org.meshtastic.proto.Telemetry

T8b949e/**
* Repository interface for managing and retrieving logs from the database.
*
* This component provides access to the application's message log, telemetry history, and debug records. It supports
* reactive queries for packets, telemetry data, and node-specific logs.
*
* This interface is shared across platforms via Kotlin Multiplatform (KMP).
*/
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffTooManyFunctionsTa5d6ff"Tb4b4b4)
Tff7b72interface T56d364MeshLogRepository Tb4b4b4{
T8b949e/** Retrieves all [MeshLog]s in the database, up to [maxItem]. */
Tff7b72fun Td2a8ffgetAllLogsTb4b4b4(Te6edf3maxItemTb4b4b4: Tffa657Int Tff7b72= Te6edf3DEFAULT_MAX_LOGSTb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3MeshLogTff7b72>Tff7b72>

T8b949e/** Retrieves all [MeshLog]s in the database in the order they were received. */
Tff7b72fun Td2a8ffgetAllLogsInReceiveOrderTb4b4b4(Te6edf3maxItemTb4b4b4: Tffa657Int Tff7b72= Te6edf3DEFAULT_MAX_LOGSTb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3MeshLogTff7b72>Tff7b72>

T8b949e/** Retrieves all [MeshLog]s in the database without any limit. */
Tff7b72fun Td2a8ffgetAllLogsUnboundedTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3MeshLogTff7b72>Tff7b72>

T8b949e/** Retrieves all [MeshLog]s associated with a specific [nodeNum] and [portNum]. */
Tff7b72fun Td2a8ffgetLogsFromTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3portNumTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3MeshLogTff7b72>Tff7b72>

T8b949e/** Retrieves all [MeshLog]s containing [MeshPacket]s for a specific [nodeNum]. */
Tff7b72fun Td2a8ffgetMeshPacketsFromTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3portNumTb4b4b4: Tffa657Int Tff7b72= Tff7b72-T79c0ff1Tb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3MeshPacketTff7b72>Tff7b72>

T8b949e/** Retrieves telemetry history for a specific node, automatically handling local node redirection. */
Tff7b72fun Td2a8ffgetTelemetryFromTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3TelemetryTff7b72>Tff7b72>

T8b949e/**
* Retrieves all outgoing request logs for a specific [targetNodeNum] and [portNum].
*
* A request log is defined as an outgoing packet where `want_response` is true.
*/
Tff7b72fun Td2a8ffgetRequestLogsTb4b4b4(Te6edf3targetNodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3portNumTb4b4b4: Te6edf3PortNumTb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3ListTff7b72<Te6edf3MeshLogTff7b72>Tff7b72>

T8b949e/** Returns the cached [MyNodeInfo] from the system logs. */
Tff7b72fun Td2a8ffgetMyNodeInfoTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3FlowTff7b72<Te6edf3MyNodeInfo?Tff7b72>

T8b949e/** Persists a new log entry to the database. */
Tff7b72suspend Tff7b72fun Td2a8ffinsertTb4b4b4(Te6edf3logTb4b4b4: Te6edf3MeshLogTb4b4b4)

T8b949e/** Clears all logs from the database. */
Tff7b72suspend Tff7b72fun Td2a8ffdeleteAllTb4b4b4(Tb4b4b4)

T8b949e/** Deletes a specific log entry by its [uuid]. */
Tff7b72suspend Tff7b72fun Td2a8ffdeleteLogTb4b4b4(Te6edf3uuidTb4b4b4: Tffa657StringTb4b4b4)

T8b949e/** Deletes all logs associated with a specific [nodeNum] and [portNum]. */
Tff7b72suspend Tff7b72fun Td2a8ffdeleteLogsTb4b4b4(Te6edf3nodeNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3portNumTb4b4b4: Tffa657IntTb4b4b4)

T8b949e/** Prunes the log database based on the configured [retentionDays]. */
Tff7b72suspend Tff7b72fun Td2a8ffdeleteLogsOlderThanTb4b4b4(Te6edf3retentionDaysTb4b4b4: Tffa657IntTb4b4b4)

Tff7b72companion Tff7b72object Tb4b4b4{
Tff7b72const Tff7b72val Te6edf3DEFAULT_MAX_LOGS Tff7b72= T79c0ff5T79c0ff0T79c0ff0T79c0ff0
Tb4b4b4}
Tb4b4b4}

Served by rngit 1.5.0 - Generated in 0.04s